home *** CD-ROM | disk | FTP | other *** search
Text File | 1994-11-06 | 1.1 KB | 50 lines | [TEXT/PJMM] |
- unit OSSubs;
-
- interface
-
- function NumToolboxTraps: integer;
- function GetTrapType (theTrap: Integer): TrapType;
- function TrapAvailable (theTrap: integer): boolean;
-
- implementation
-
- uses
- Traps;
-
- function NumToolboxTraps: integer;
- begin
- if NGetTrapAddress(_InitGraf, ToolTrap) = NGetTrapAddress($AA6E, ToolTrap) then begin
- NumToolboxTraps := $200
- end
- else begin
- NumToolboxTraps := $400;
- end; (* if *)
- end; (* NumToolboxTraps *)
-
- function GetTrapType (theTrap: integer): TrapType;
- const
- TrapMask = $0800;
- begin
- if band(theTrap, TrapMask) > 0 then begin
- GetTrapType := ToolTrap
- end
- else begin
- GetTrapType := OSTrap;
- end; (* if *)
- end; (* GetTrapType *)
-
- function TrapAvailable (theTrap: integer): boolean;
- var
- tType: TrapType;
- begin
- tType := GetTrapType(theTrap);
- if tType = ToolTrap then begin
- theTrap := band(theTrap, $07FF);
- if theTrap >= NumToolboxTraps then begin
- theTrap := _Unimplemented;
- end; (* if *)
- end; (* if *)
- TrapAvailable := NGetTrapAddress(theTrap, tType) <> NGetTrapAddress(_Unimplemented, ToolTrap);
- end; (* TrapAvailable *)
-
- end. (* OSSubs *)